using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{


    public partial class VVKZUAB
    {
        #region
        #endregion
        public void SetUpNewRow(ref DataRow dwReturn)
        {

            switch (app.company)
            {
                default:
                case "YGR":
                case "TST":
                    #region
                    dwReturn["VKZMANDANT"] = app.Mandant;
                    dwReturn["VKZSA"] = " ";
                    dwReturn["VKZAUFKRS"] = " ";
                    dwReturn["VKZAUFLFD"] = "000000";
                    dwReturn["VKZAUFPOS"] = "000";
                    dwReturn["VKZAENDST"] = "000";
                    dwReturn["VKZAENZL"] = "0";
                    dwReturn["VKZAENB"] = " ";
                    dwReturn["VKZAEND"] = "0";
                    dwReturn["VKZVERTNR1"] = "00000000";
                    dwReturn["VKZPROVPFL1"] = "J";
                    dwReturn["VKZPROV1"] = "0";
                    dwReturn["VKZPVBAS1"] = "U";
                    dwReturn["VKZPVVAR1"] = "0";
                    dwReturn["VKZVERTNR2"] = "00000000";
                    dwReturn["VKZPROVPFL2"] = "J";
                    dwReturn["VKZPROV2"] = "0";
                    dwReturn["VKZPVBAS2"] = " ";
                    dwReturn["VKZPVVAR2"] = "0";
                    dwReturn["VKZVERTNR3"] = " ";
                    dwReturn["VKZPROVPFL3"] = " ";
                    dwReturn["VKZPROV3"] = "0";
                    dwReturn["VKZPVBAS3"] = " ";
                    dwReturn["VKZPVVAR3"] = "0";
                    dwReturn["VKZVERTNR4"] = " ";
                    dwReturn["VKZPROVPFL4"] = " ";
                    dwReturn["VKZPROV4"] = "0";
                    dwReturn["VKZPVBAS4"] = " ";
                    dwReturn["VKZPVVAR4"] = "0";
                    dwReturn["VKZRABART1"] = " ";
                    dwReturn["VKZRABPROZ1"] = "0";
                    dwReturn["VKZRABART2"] = " ";
                    dwReturn["VKZRABPROZ2"] = "0";
                    dwReturn["VKZRABART3"] = " ";
                    dwReturn["VKZRABPROZ3"] = "0";
                    dwReturn["VKZRABART4"] = " ";
                    dwReturn["VKZRABPROZ4"] = "0";
                    dwReturn["VKZRABART5"] = " ";
                    dwReturn["VKZRABPROZ5"] = "0";
                    dwReturn["VKZZUART1"] = " ";
                    dwReturn["VKZZUABPROZ1"] = "0";
                    dwReturn["VKZZUABWERT1"] = "0";
                    dwReturn["VKZMEEH1"] = " ";
                    dwReturn["VKZABRKZ1"] = " ";
                    dwReturn["VKZZUART2"] = " ";
                    dwReturn["VKZZUABPROZ2"] = "0";
                    dwReturn["VKZZUABWERT2"] = "0";
                    dwReturn["VKZMEEH2"] = " ";
                    dwReturn["VKZABRKZ2"] = " ";
                    dwReturn["VKZZUART3"] = " ";
                    dwReturn["VKZZUABPROZ3"] = "0";
                    dwReturn["VKZZUABWERT3"] = "0";
                    dwReturn["VKZMEEH3"] = " ";
                    dwReturn["VKZABRKZ3"] = " ";
                    dwReturn["VKZZUART4"] = " ";
                    dwReturn["VKZZUABPROZ4"] = "0";
                    dwReturn["VKZZUABWERT4"] = "0";
                    dwReturn["VKZMEEH4"] = " ";
                    dwReturn["VKZABRKZ4"] = " ";
                    dwReturn["VKZZUART5"] = " ";
                    dwReturn["VKZZUABPROZ5"] = "0";
                    dwReturn["VKZZUABWERT5"] = "0";
                    dwReturn["VKZMEEH5"] = " ";
                    dwReturn["VKZABRKZ5"] = " ";
                    dwReturn["VKZZUARTF"] = " ";
                    dwReturn["VKZZUABPROZF"] = "0";
                    dwReturn["VKZZUABWERTF"] = "0";
                    dwReturn["VKZMEEHF"] = " ";
                    dwReturn["VKZABRKZF"] = " ";
                    dwReturn["VKZZUARTV"] = " ";
                    dwReturn["VKZZUABPROZV"] = "0";
                    dwReturn["VKZZUABWERTV"] = "0";
                    dwReturn["VKZMEEHV"] = " ";
                    dwReturn["VKZABRKZV"] = " ";
                    dwReturn["VKZVTYP1"] = " ";
                    dwReturn["VKZVERPART1"] = " ";
                    dwReturn["VKZVERPWERT1"] = "0";
                    dwReturn["VKZVTYP2"] = " ";
                    dwReturn["VKZVERPART2"] = " ";
                    dwReturn["VKZVERPWERT2"] = "0";
                    dwReturn["VKZVTYP3"] = " ";
                    dwReturn["VKZVERPART3"] = " ";
                    dwReturn["VKZVERPWERT3"] = "0";
                    dwReturn["VKZVTYP4"] = " ";
                    dwReturn["VKZVERPART4"] = " ";
                    dwReturn["VKZVERPWERT4"] = "0";
                    dwReturn["VKZVTYP5"] = " ";
                    dwReturn["VKZVERPART5"] = " ";
                    dwReturn["VKZVERPWERT5"] = "0";
                    dwReturn["VKZSTMENGE1"] = "0";
                    dwReturn["VKZSTKZ1"] = " ";
                    dwReturn["VKZFCANZ1"] = "0";
                    dwReturn["VKZFCKG1"] = "0";
                    dwReturn["VKZSTPREIS1"] = "0000000000";
                    dwReturn["VKZSTMENGE2"] = "0";
                    dwReturn["VKZSTKZ2"] = " ";
                    dwReturn["VKZFCANZ2"] = "0";
                    dwReturn["VKZFCKG2"] = "0";
                    dwReturn["VKZSTPREIS2"] = "0000000000";
                    dwReturn["VKZSTMENGE3"] = "0";
                    dwReturn["VKZSTKZ3"] = " ";
                    dwReturn["VKZFCANZ3"] = "0";
                    dwReturn["VKZFCKG3"] = "0";
                    dwReturn["VKZSTPREIS3"] = "0000000000";
                    dwReturn["VKZSTMENGE4"] = "0";
                    dwReturn["VKZSTKZ4"] = " ";
                    dwReturn["VKZFCANZ4"] = "0";
                    dwReturn["VKZFCKG4"] = "0";
                    dwReturn["VKZSTPREIS4"] = "0000000000";
                    dwReturn["VKZSTMENGE5"] = "0";
                    dwReturn["VKZSTKZ5"] = " ";
                    dwReturn["VKZFCANZ5"] = "0";
                    dwReturn["VKZFCKG5"] = "0";
                    dwReturn["VKZSTPREIS5"] = "0000000000";
                    dwReturn["VKZGZUSCHL1"] = " ";
                    dwReturn["VKZGZUART1"] = " ";
                    dwReturn["VKZGZUNR1"] = " ";
                    dwReturn["VKZGZUWERT1"] = "0";
                    dwReturn["VKZGPROZKZ1"] = " ";
                    dwReturn["VKZGMEEH1"] = " ";
                    dwReturn["VKZGZUSCHL2"] = " ";
                    dwReturn["VKZGZUART2"] = " ";
                    dwReturn["VKZGZUNR2"] = " ";
                    dwReturn["VKZGZUWERT2"] = "0";
                    dwReturn["VKZGPROZKZ2"] = " ";
                    dwReturn["VKZGMEEH2"] = " ";
                    dwReturn["VKZGZUSCHL3"] = " ";
                    dwReturn["VKZGZUART3"] = " ";
                    dwReturn["VKZGZUNR3"] = " ";
                    dwReturn["VKZGZUWERT3"] = "0";
                    dwReturn["VKZGPROZKZ3"] = " ";
                    dwReturn["VKZGMEEH3"] = " ";
                    dwReturn["VKZGZUSCHL4"] = " ";
                    dwReturn["VKZGZUART4"] = " ";
                    dwReturn["VKZGZUNR4"] = " ";
                    dwReturn["VKZGZUWERT4"] = "0";
                    dwReturn["VKZGPROZKZ4"] = " ";
                    dwReturn["VKZGMEEH4"] = " ";
                    dwReturn["VKZGZUSCHL5"] = " ";
                    dwReturn["VKZGZUART5"] = " ";
                    dwReturn["VKZGZUNR5"] = " ";
                    dwReturn["VKZGZUWERT5"] = "0";
                    dwReturn["VKZGPROZKZ5"] = " ";
                    dwReturn["VKZGMEEH5"] = " ";
                    dwReturn["VKZGZUSCHL6"] = " ";
                    dwReturn["VKZGZUART6"] = " ";
                    dwReturn["VKZGZUNR6"] = " ";
                    dwReturn["VKZGZUWERT6"] = "0";
                    dwReturn["VKZGPROZKZ6"] = " ";
                    dwReturn["VKZGMEEH6"] = " ";
                    dwReturn["VKZGZUSCHL7"] = " ";
                    dwReturn["VKZGZUART7"] = " ";
                    dwReturn["VKZGZUNR7"] = " ";
                    dwReturn["VKZGZUWERT7"] = "0";
                    dwReturn["VKZGPROZKZ7"] = " ";
                    dwReturn["VKZGMEEH7"] = " ";
                    dwReturn["VKZGZUSCHL8"] = " ";
                    dwReturn["VKZGZUART8"] = " ";
                    dwReturn["VKZGZUNR8"] = " ";
                    dwReturn["VKZGZUWERT8"] = "0";
                    dwReturn["VKZGPROZKZ8"] = " ";
                    dwReturn["VKZGMEEH8"] = " ";
                    dwReturn["VKZGZUSCHL9"] = " ";
                    dwReturn["VKZGZUART9"] = " ";
                    dwReturn["VKZGZUNR9"] = " ";
                    dwReturn["VKZGZUWERT9"] = "0";
                    dwReturn["VKZGPROZKZ9"] = " ";
                    dwReturn["VKZGMEEH9"] = " ";
                    dwReturn["VKZGZUSCHL10"] = " ";
                    dwReturn["VKZGZUART10"] = " ";
                    dwReturn["VKZGZUNR10"] = " ";
                    dwReturn["VKZGZUWERT10"] = "0";
                    dwReturn["VKZGPROZKZ10"] = " ";
                    dwReturn["VKZGMEEH10"] = " ";
                    dwReturn["VKZAESTAT"] = "A";
                    dwReturn["VKZERSTKZ"] = "J";
                    dwReturn["VKZZUABMG1"] = "0";
                    dwReturn["VKZZUABMG2"] = "0";
                    dwReturn["VKZZUABMG3"] = "0";
                    dwReturn["VKZZUABMG4"] = "0";
                    dwReturn["VKZZUABMG5"] = "0";
                    dwReturn["VKZANTEIL1"] = "0";
                    dwReturn["VKZWOHER1"] = " ";
                    dwReturn["VKZANTEIL2"] = "0";
                    dwReturn["VKZWOHER2"] = " ";
                    dwReturn["VKZANTEIL3"] = "0";
                    dwReturn["VKZWOHER3"] = " ";
                    dwReturn["VKZANTEIL4"] = "0";
                    dwReturn["VKZWOHER4"] = " ";
                    dwReturn["VKZANTSUMME"] = "0";
                    dwReturn["VKZFILLER"] = " ";
                    #endregion
                    break;
            }
        }
        public void InsertVKZUAB(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            dwData["VKZAENB"] = app.User;
            dwData["VKZAEND"] = date;
            or1 = OracleDB.CreateCommand();
            switch (ITXDBVERSION)
            {
                default:
                case "YGR":
                    or1.CommandText = "INSERT INTO VKZUAB ( VKZMANDANT,VKZSA,VKZAUFKRS,VKZAUFLFD,VKZAUFPOS,VKZAENDST,VKZAENZL,VKZAENB,VKZAEND,VKZVERTNR1,VKZPROVPFL1,VKZPROV1,VKZPVBAS1,VKZPVVA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:VKZFILLER:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            Connect2Proxy(or1);
        }
        public DataSet QueryVKZUAB(DataRow dwData, int option = 1)
        { 
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM VKZUAB WHERE ROWNUM<2 ";
                    SResult = Connect2Proxy(or1);
                    break;
                case 1:
                    or1.CommandText = "SELECT DISTINCT P.* FROM VKZUAB P "
                    + " JOIN VKPOS ON VKZSA=' ' AND VKPSA=' ' AND VKZMANDANT=VKPMANDANT AND VKPAUFKRS=VKZAUFKRS AND VKPAUFLFD=VKZAUFLFD AND VKPAUFPOS=VKZAUFPOS"
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 2:
                    or1.CommandText = "SELECT DISTINCT * FROM VKZUAB "
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: AND VKZAUFPOS=:VKZAUFPOS:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 3:
                    or1.CommandText = "SELECT DISTINCT P.* FROM VKZUAB P WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 4:
                    or1.CommandText = "SELECT DISTINCT P.* FROM VKZUAB P "
                    + " JOIN VKPOS ON VKZSA=:VKPSA: AND VKZMANDANT=VKPMANDANT AND VKPAUFKRS=VKZAUFKRS AND VKPAUFLFD=VKZAUFLFD AND VKPAUFPOS=VKZAUFPOS"
                    + " WHERE VKPMANDANT=:VKPMANDANT: AND VKPSA=' ' AND VKPAUFKRS=:VKPAUFKRS: AND VKPKOLL=:VKPKOLL: AND VKPART=:VKPART: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                case 9:
                    or1.CommandText = "SELECT DISTINCT VVLIEFSCH,P.* FROM VKZUAB P "
                    + " JOIN VVTLIEF ON VVTAUFTYP='K' AND VVTAUFKRS=VKZAUFKRS AND VVTAUFLFD=VKZAUFLFD AND VVTAUFPOS=VKZAUFPOS JOIN VVLIEF ON VVLIEFSCH=VVTLIEFSCH"
                    + " WHERE VVMANDANT=:VVMANDANT: AND VVLIEFSCH=:VVLIEFSCH:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    SResult = Connect2Proxy(or1);
                    break;
                default:
                    break;
            }

          
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public void DeleteVKZUAB(DataRow dwData, int option = 1)
        {

            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "DELETE FROM VKZUAB WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 1:
                    or1.CommandText = "DELETE FROM VKZUAB WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: AND VKZAUFPOS=:VKZAUFPOS:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 2:
                    or1.CommandText = "DELETE FROM VKZUAB WHERE VKZMANDANT=:VKZMANDANT: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: "
                    + " AND NOT EXISTS (SELECT 1 FROM VKPOS WHERE VKPMANDANT=VKZMANDANT AND VKPAUFKRS=VKZAUFKRS AND VKPAUFLFD=VKZAUFLFD AND VKPAUFPOS=VKZAUFPOS)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }

        public void UpdateVKZUAB(DataRow dwData, string ITXDBVERSION = "50.24", int option = 1)
        {
            if (dwData != null)
            {
                dwData["VKZAENB"] = app.User;
                dwData["VKZAEND"] = date;
            }
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                default:
                case 1:
                    or1.CommandText = "UPDATE VKZUAB SET VKZMANDANT=:VKZMANDANT:,VKZSA=:VKZSA:,VKZAUFKRS=:VKZAUFKRS:,VKZAUFLFD=:VKZAUFLFD:,VKZAUFPOS=:VKZAUFPOS:,VKZAENDST=:VKZAENDST:,VKZAENZL=:VKZAENZL:,VKZAENB=:VKZAENB:,VKZAEND=:VKZAEND:,VKZVERTNR1=:VKZVERTNR1:,VKZPROVPFL1=:VKZPROVPFL1:,VKZPROV1=:VKZPROV1:,VKZPVBAS1=:VKZPVBAS1:,VKZPVVAR1=:VKZPVVAR1:,VKZVERTNR2=:VKZVERTNR2:,VKZPROVPFL2=:VKZPROVPFL2:,VKZPROV2=:VKZPROV2:,VKZPVBAS2=:VKZPVBAS2:,VKZPVVAR2=:VKZPVVAR2:,VKZVERTNR3=:VKZVERTNR3:,VKZPROVPFL3=:VKZPROVPFL3:,VKZPROV3=:VKZPROV3:,VKZPVBAS3=:VKZPVBAS3:,VKZPVVAR3=:VKZPVVAR3:,VKZVERTNR4=:VKZVERTNR4:,VKZPROVPFL4=:VKZPROVPFL4:,VKZPROV4=:VKZPROV4:,VKZPVBAS4=:VKZPVBAS4:,VKZPVVAR4=:VKZPVVAR4:,VKZRABART1=:VKZRABART1:,VKZRABPROZ1=:VKZRABPROZ1:,VKZRABART2=:VKZRABART2:,VKZRABPROZ2=:VKZRABPROZ2:,VKZRABART3=:VKZRABART3:,VKZRABPROZ3=:VKZRABPROZ3:,VKZRABART4=:VKZRABART4:,VKZRABPROZ4=:VKZRABPROZ4:,VKZRABART5=:VKZRABART5:,VKZRABPROZ5=:VKZRABPROZ5:,VKZZUART1=:VKZZUART1:,VKZZUABPROZ1=:VKZZUABPROZ1:,VKZZUABWERT1=:VKZZUABWERT1:,VKZMEEH1=:VKZMEEH1:,VKZABRKZ1=:VKZABRKZ1:,VKZZUART2=:VKZZUART2:,VKZZUABPROZ2=:VKZZUABPROZ2:,VKZZUABWERT2=:VKZZUABWERT2:,VKZMEEH2=:VKZMEEH2:,VKZABRKZ2=:VKZABRKZ2:,VKZZUART3=:VKZZUART3:,VKZZUABPROZ3=:VKZZUABPROZ3:,VKZZUABWERT3=:VKZZUABWERT3:,VKZMEEH3=:VKZMEEH3:,VKZABRKZ3=:VKZABRKZ3:,VKZZUART4=:VKZZUART4:,VKZZUABPROZ4=:VKZZUABPROZ4:,VKZZUABWERT4=:VKZZUABWERT4:,VKZMEEH4=:VKZMEEH4:,VKZABRKZ4=:VKZABRKZ4:,VKZZUART5=:VKZZUART5:,VKZZUABPROZ5=:VKZZUABPROZ5:,VKZZUABWERT5=:VKZZUABWERT5:,VKZMEEH5=:VKZMEEH5:,VKZABRKZ5=:VKZABRKZ5:,VKZZUARTF=:VKZZUARTF:,VKZZUABPROZF=:VKZZUABPROZF:,VKZZUABWERTF=:VKZZUABWERTF:,VKZMEEHF=:VKZMEEHF:,VKZABRKZF=:VKZABRKZF:,VKZZUARTV=:VKZZUARTV:,VKZZUABPROZV=:VKZZUABPROZV:,VKZZUABWERTV=:VKZZUABWERTV:,VKZMEEHV=:VKZMEEHV:,VKZABRKZV=:VKZABRKZV:,VKZVTYP1=:VKZVTYP1:,VKZVERPART1=:VKZVERPART1:,VKZVERPWERT1=:VKZVERPWERT1:,VKZVTYP2=:VKZVTYP2:,VKZVERPART2=:VKZVERPART2:,VKZVERPWERT2=:VKZVERPWERT2:,VKZVTYP3=:VKZVTYP3:,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:VKZGZUSCHL7:,VKZGZUART7=:VKZGZUART7:,VKZGZUNR7=:VKZGZUNR7:,VKZGZUWERT7=:VKZGZUWERT7:,VKZGPROZKZ7=:VKZGPROZKZ7:,VKZGMEEH7=:VKZGMEEH7:,VKZGZUSCHL8=:VKZGZUSCHL8:,VKZGZUART8=:VKZGZUART8:,VKZGZUNR8=:VKZGZUNR8:,VKZGZUWERT8=:VKZGZUWERT8:,VKZGPROZKZ8=:VKZGPROZKZ8:,VKZGMEEH8=:VKZGMEEH8:,VKZGZUSCHL9=:VKZGZUSCHL9:,VKZGZUART9=:VKZGZUART9:,VKZGZUNR9=:VKZGZUNR9:,VKZGZUWERT9=:VKZGZUWERT9:,VKZGPROZKZ9=:VKZGPROZKZ9:,VKZGMEEH9=:VKZGMEEH9:,VKZGZUSCHL10=:VKZGZUSCHL10:,VKZGZUART10=:VKZGZUART10:,VKZGZUNR10=:VKZGZUNR10:,VKZGZUWERT10=:VKZGZUWERT10:,VKZGPROZKZ10=:VKZGPROZKZ10:,VKZGMEEH10=:VKZGMEEH10:,VKZAESTAT=:VKZAESTAT:,VKZERSTKZ=:VKZERSTKZ:,VKZZUABMG1=:VKZZUABMG1:,VKZZUABMG2=:VKZZUABMG2:,VKZZUABMG3=:VKZZUABMG3:,VKZZUABMG4=:VKZZUABMG4:,VKZZUABMG5=:VKZZUABMG5:,VKZANTEIL1=:VKZANTEIL1:,VKZWOHER1=:VKZWOHER1:,VKZANTEIL2=:VKZANTEIL2:,VKZWOHER2=:VKZWOHER2:,VKZANTEIL3=:VKZANTEIL3:,VKZWOHER3=:VKZWOHER3:,VKZANTEIL4=:VKZANTEIL4:,VKZWOHER4=:VKZWOHER4:,VKZANTSUMME=:VKZANTSUMME:,VKZFILLER=:VKZFILLER:"
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: AND VKZAUFPOS=:VKZAUFPOS:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 2:
                    UVKZUAB02(dwData);
                    break;
                case 3:
                    or1.CommandText = "UPDATE VKZUAB SET VKZZUART1=:VKZZUART1:,VKZZUABPROZ1=:VKZZUABPROZ1:,VKZZUABWERT1=:VKZZUABWERT1:,VKZMEEH1=:VKZMEEH1:,VKZABRKZ1=:VKZABRKZ1:,VKZZUART2=:VKZZUART2:,VKZZUABPROZ2=:VKZZUABPROZ2:,VKZZUABWERT2=:VKZZUABWERT2:,VKZMEEH2=:VKZMEEH2:,VKZABRKZ2=:VKZABRKZ2:,VKZZUART3=:VKZZUART3:,VKZZUABPROZ3=:VKZZUABPROZ3:,VKZZUABWERT3=:VKZZUABWERT3:,VKZMEEH3=:VKZMEEH3:,VKZABRKZ3=:VKZABRKZ3:,VKZZUART4=:VKZZUART4:,VKZZUABPROZ4=:VKZZUABPROZ4:,VKZZUABWERT4=:VKZZUABWERT4:,VKZMEEH4=:VKZMEEH4:,VKZABRKZ4=:VKZABRKZ4:,VKZZUART5=:VKZZUART5:,VKZZUABPROZ5=:VKZZUABPROZ5:,VKZZUABWERT5=:VKZZUABWERT5:,VKZMEEH5=:VKZMEEH5:,VKZABRKZ5=:VKZABRKZ5:"
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 4:
                    or1.CommandText = "UPDATE VKZUAB SET VKZRABART1=:VKZRABART1:,VKZRABPROZ1=:VKZRABPROZ1:,VKZRABART2=:VKZRABART2:,VKZRABPROZ2=:VKZRABPROZ2:,VKZRABART3=:VKZRABART3:,VKZRABPROZ3=:VKZRABPROZ3:,VKZRABART4=:VKZRABART4:,VKZRABPROZ4=:VKZRABPROZ4:,VKZRABART5=:VKZRABART5:,VKZRABPROZ5=:VKZRABPROZ5:"
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 5:
                    or1.CommandText = "UPDATE VKZUAB SET VKZSTMENGE1=:VKZSTMENGE1:,VKZSTKZ1=:VKZSTKZ1:,VKZFCANZ1=:VKZFCANZ1:,VKZFCKG1=:VKZFCKG1:,VKZSTPREIS1=:VKZSTPREIS1:,VKZSTMENGE2=:VKZSTMENGE2:,VKZSTKZ2=:VKZSTKZ2:,VKZFCANZ2=:VKZFCANZ2:,VKZFCKG2=:VKZFCKG2:,VKZSTPREIS2=:VKZSTPREIS2:,VKZSTMENGE3=:VKZSTMENGE3:,VKZSTKZ3=:VKZSTKZ3:,VKZFCANZ3=:VKZFCANZ3:,VKZFCKG3=:VKZFCKG3:,VKZSTPREIS3=:VKZSTPREIS3:,VKZSTMENGE4=:VKZSTMENGE4:,VKZSTKZ4=:VKZSTKZ4:,VKZFCANZ4=:VKZFCANZ4:,VKZFCKG4=:VKZFCKG4:,VKZSTPREIS4=:VKZSTPREIS4:,VKZSTMENGE5=:VKZSTMENGE5:,VKZSTKZ5=:VKZSTKZ5:,VKZFCANZ5=:VKZFCANZ5:,VKZFCKG5=:VKZFCKG5:,VKZSTPREIS5=:VKZSTPREIS5:"
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: AND VKZAUFPOS=:VKZAUFPOS:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 20:
                    or1.CommandText = "UPDATE VKZUAB SET VKZSA=:VKZSA: ,VKZAEND=:VKZAEND:,VKZAENB=:VKZAENB:"
                    + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: " + dwData["VKZAUFPOS"].ToString(); ;
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
            }
            
        }
        public void UVKZUAB02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE VKZUAB SET VKZAENB=:VKZAENB:,VKZAEND=:VKZAEND:,VKZVERTNR1=:VKZVERTNR1:,VKZPROVPFL1=:VKZPROVPFL1:,VKZPROV1=:VKZPROV1:,VKZPVBAS1=:VKZPVBAS1:,VKZPVVAR1=:VKZPVVAR1:,VKZVERTNR2=:VKZVERTNR2:,VKZPROVPFL2=:VKZPROVPFL2:,VKZPROV2=:VKZPROV2:,VKZPVBAS2=:VKZPVBAS2:,VKZPVVAR2=:VKZPVVAR2:,VKZVERTNR3=:VKZVERTNR3:,VKZPROVPFL3=:VKZPROVPFL3:,VKZPROV3=:VKZPROV3:,VKZPVBAS3=:VKZPVBAS3:,VKZPVVAR3=:VKZPVVAR3:,VKZVERTNR4=:VKZVERTNR4:,VKZPROVPFL4=:VKZPROVPFL4:,VKZPROV4=:VKZPROV4:,VKZPVBAS4=:VKZPVBAS4:,VKZPVVAR4=:VKZPVVAR4:"
                 + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
        public void UVKZUAB201(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE VKZUAB SET VKZAENB=:VKZAENB:,VKZAEND=:VKZAEND:,VKZVERTNR1=:VKZVERTNR1:,VKZPROVPFL1=:VKZPROVPFL1:,VKZPROV1=:VKZPROV1:,VKZPVBAS1=:VKZPVBAS1:,VKZPVVAR1=:VKZPVVAR1:,VKZVERTNR2=:VKZVERTNR2:,VKZPROVPFL2=:VKZPROVPFL2:,VKZPROV2=:VKZPROV2:,VKZPVBAS2=:VKZPVBAS2:,VKZPVVAR2=:VKZPVVAR2:,VKZVERTNR3=:VKZVERTNR3:,VKZPROVPFL3=:VKZPROVPFL3:,VKZPROV3=:VKZPROV3:,VKZPVBAS3=:VKZPVBAS3:,VKZPVVAR3=:VKZPVVAR3:,VKZVERTNR4=:VKZVERTNR4:,VKZPROVPFL4=:VKZPROVPFL4:,VKZPROV4=:VKZPROV4:,VKZPVBAS4=:VKZPVBAS4:,VKZPVVAR4=:VKZPVVAR4:"
                 + " WHERE VKZMANDANT=:VKZMANDANT: AND VKZSA=:VKZSA: AND VKZAUFKRS=:VKZAUFKRS: AND VKZAUFLFD=:VKZAUFLFD: AND VKZAUFPOS=:VKZAUFPOS:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
    }
}
